package org.example.Strategy;

import java.math.BigDecimal;

//百分比折扣策略
public class PercentageDiscount implements DiscountStrategy{
    //百分比则扣
    private BigDecimal discountRate;

    public PercentageDiscount(BigDecimal discountRate) {
        this.discountRate = discountRate;
    }

    @Override
    public BigDecimal applyDiscount(BigDecimal basePrice, int quantity) {
        return basePrice.multiply(BigDecimal.valueOf(quantity)).multiply(discountRate);
    }
}
